package com.jeeplus.cms.config.freemarker.function;

import com.jeeplus.cms.common.CmsProperties;
import freemarker.template.TemplateMethodModelEx;
import freemarker.template.TemplateModelException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author WuXilin
 */
@Component
public class GetConfig implements TemplateMethodModelEx {

    @Autowired
    private CmsProperties cmsProperties;

    @Override
    public Object exec(List list) throws TemplateModelException {
        return cmsProperties.getConfig(String.valueOf(list.get(0)));
    }
}
